FROM php:7.4-fpm
#设置工作目录
WORKDIR /www

ENV WORK  /data
RUN mkdir -p $WORK
COPY phpredis-5.3.4.tar.gz $WORK
COPY composer.phar $WORK

# 设置时区
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
    && sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list \
    && sed -i s@/security.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list \
    && apt-get clean \
    && apt-get update \
    && apt-get install -y \
    --allow-downgrades --no-install-recommends unzip zip git libzip-dev  zlib1g-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev curl librabbitmq-dev openssh-client vim \
    && rm -r /var/lib/apt/lists/* \
    && docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ \
    && docker-php-ext-install -j$(nproc) gd opcache pdo_mysql gettext sockets zip bcmath mysqli

# 编译安装Redis扩展
RUN cd $WORK && mkdir -p redis && tar -zxvf phpredis-5.3.4.tar.gz -C redis --strip-components=1 && cd redis  \
      && phpize && ./configure && make && make install \
      && docker-php-ext-enable redis



#安装composer
RUN cd $WORK &&  mv composer.phar /usr/local/bin/composer \
    && chmod +x /usr/local/bin/composer \
            # clear
            && php -v \
            && php -m \
            && echo -e "\033[42;37m Build Completed :).\033[0m\n"
ENV LC_ALL C.UTF-8
